package service;

import bean.Commodity;
import bean.HomeData;
import dao.CommodityDao;

import java.util.List;

public class CommodityService {
    public static void prepareForHome(HomeData homeData){
        if (homeData.getKeyword()==null){
            CommodityDao.selectForHomeBySort(homeData);
        }else{
            CommodityDao.selectForKeyword(homeData);
        }
    }
    public static void prepareForShoppingCar(HomeData homeData,List<Integer> shoppingCar){
        if (shoppingCar==null|| shoppingCar.isEmpty()){
            homeData.setTotalElement(0);
            return;
        }
        CommodityDao.selectForList(homeData,shoppingCar);
    }
}
